Chapter 3. HTTP Requests in Laravel

HTTP Requests


What are they?

Types of queries

GET

http://alfred.com/hack?hack="123"

In this case, hack is the variable, and its value is 123

Also, this type of queries are used to render parts of the webpage. To get all data and show it to the user

Route::get("", function () {
	return "Hello world";
});

POST

POST

It is the most common, it is used when you send information through a form

<form action="/send" method="POST">
	<input type="text" name="name">
	<input type="submit" value="Submit">
</form>
Route::post("/send", function () {
	return "To create";
});

PUT Y PATCH

They are using to update records

PUT

Route::put("/update", function () {
	return "To update";
});

PATCH

Route::patch("/update-partial", function () {
	return "To update";
});

DELETE

Route::post("/delete", function () {
	return "To delete"
});
Info

All of these methods will be more explanied further on.